#pragma once

#include <vector>
#include <string>


using namespace std;

struct edit_operation {
	char action;
	string str;
};

vector<edit_operation> get_edit_sequence(const vector<string> &first_string_sequence,
	const vector<string> &second_string_sequence,
	const vector<string> &string_lcs) {
	int first_seq_pointer = 0, second_seq_pointer = 0, edit_seq_pointer = 0;
	int lcs_length = string_lcs.size();

	vector<edit_operation> edit_sequence;

	while (first_seq_pointer < (int)first_string_sequence.size() || second_seq_pointer < (int)second_string_sequence.size()){
		if (first_seq_pointer < (int)first_string_sequence.size() && (edit_seq_pointer >= lcs_length || first_string_sequence[first_seq_pointer] != string_lcs[edit_seq_pointer])){
			edit_operation next_operation;
			next_operation.action = '-';
			next_operation.str = first_string_sequence[first_seq_pointer++];
			edit_sequence.push_back(next_operation);
			continue;
		}

		if (second_seq_pointer < (int)second_string_sequence.size() && (edit_seq_pointer >= lcs_length || second_string_sequence[second_seq_pointer] != string_lcs[edit_seq_pointer])){
			edit_operation next_operation;
			next_operation.action = '+';
			next_operation.str = second_string_sequence[second_seq_pointer++];
			edit_sequence.push_back(next_operation);
			continue;
		}
		edit_operation next_operation;
		next_operation.action = ' ';
		next_operation.str = first_string_sequence[first_seq_pointer];
		edit_sequence.push_back(next_operation);
		first_seq_pointer++, second_seq_pointer++, edit_seq_pointer++;
	}
	return edit_sequence;
}
